Typed Combinators for Generic Traversal
نویسندگان
چکیده
Lacking support for generic traversal, functional programming languages su er from a scalability problem when applied to largescale program transformation problems. As a solution, we introduce functional strategies: typeful generic functions that not only can be applied to terms of any type, but which also allow generic traversal into subterms. We show how strategies are modelled inside a functional language, and we present a combinator library including generic traversal combinators. We illustrate our technique of programming with functional strategies by an implementation of the extract method refactoring for Java.
منابع مشابه
ar X iv : c s / 02 05 01 8 v 1 [ cs . P L ] 1 4 M ay 2 00 2 Typed Generic Traversal With Term Rewriting Strategies
A typed model of strategic term rewriting is developed. The key innovation is that generic traversal is covered. To this end, we define a typed rewriting calculus S γ . The calculus employs a many-sorted type system extended by designated generic strategy types γ. We consider two generic strategy types, namely the types of type-preserving and type-unifying strategies. S γ offers traversal combi...
متن کاملTyped generic traversal with term rewriting strategies
A typed model of strategic term rewriting is developed. The key innovation is that generic traversal is covered. To this end, we define a typed rewriting calculus S γ . The calculus employs a many-sorted type system extended by designated generic strategy types γ. We consider two generic strategy types, namely the types of type-preserving and type-unifying strategies. S γ offers traversal combi...
متن کاملUniform Traversal Combinators: Definition, Use and Properties
In this paper we explore ways of capturing well-formed patterns of recursion in the form of generic reductions. These reductions, called uniform traversal combinators, can substantially help the theorem proving process by eliminating the need for induction and can also be an aid in achieving eeective program synthesis.
متن کاملAlgebraic Specialization of Generic Functions for Recursive Types
Defining functions over large, possibly recursive, data structures usually involves a lot of boilerplate. This code simply traverses non-interesting parts of the data, and rapidly becomes a maintainability problem. Many generic programming libraries have been proposed to address this issue. Most of them allow the user to specify the behavior just for the interesting bits of the structure, and p...
متن کاملLanguage Independent Traversals for Program Transformation
A Stratego program defines a transformation on first-order ground terms. Transformation rules define single transformation steps. Transformation rules are combined into transformation strategies by means of combinators that determine where and in what order rules are applied. These combinators include: primitives for traversal to the direct subterms of a node, allowing the definition of many ki...
متن کامل